$(document).ready(function(){
   $('#user_logged_in').hover(function(){
    $("#user_manage").slideDown('slow');
    $("#user_manage").mouseleave(function(){
        $(this).slideUp('slow');    
    });
   });
});


function buyProduct(productId){
    var urlHandle = '/chuotlenshop/buyproduct.php?id='+productId; 
    jQuery.ajax({
        'method':'POST',
        'url'   : urlHandle,
        'success' : function(data){
            //alert('success ');
            jQuery('#cart_count').html((data));
        },
        'fail': function(data){
            alert('fail' + data);
        }
    });
}

function removeProduct(productId){
    var urlHandle = '/chuotlenshop/buyproduct.php'; 
    $.ajax({
        'method':'POST',
        'url'   : urlHandle,
        'data'  : 'id='+productId+'&action=remove',
        'success' : function(data){
            alert(data);
            jQuery('#cart_count').html((data));
        },
        'fail': function(){
            alert('fail');
        }
    });
}

function updateCart(object){
    var parent = $(object).parents('tr:first');
    alert($(parent));
}